/*
 * Copyright (C) 2015-2016  Nicola Spanti (RyDroid) <dev@nicola-spanti.info>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */


#include "PlanetWars2dRT-core/specific/model/universe.h"
#include "PlanetWars2dRT-core/utils/collision_2d_uint.h"
#include "PlanetWars2dRT-core/specific/model/planet_observers.h"


EXTERN_C_BEGIN


void
universe_init_first_time_only(struct universe_t* a_universe)
{
  VECTOR_GENERIC_STATIC_INIT_FIRST_TIME_ONLY(&a_universe->planets, 0,
					     planet_t);
  VECTOR_GENERIC_STATIC_INIT_FIRST_TIME_ONLY(&a_universe->ships, 0,
					     ship_t);
  observers_init_first_time_only(&a_universe->observers);
}

void
universe_destructor(universe_t* a_universe)
{
  universe_remove_planets    (a_universe);
  universe_remove_ships      (a_universe);
  universe_remove_black_holes(a_universe);
  universe_remove_wormholes  (a_universe);
  universe_remove_supernovas (a_universe);
  universe_remove_observers  (a_universe);
}


EXTERN_C_END
